package cn.dida.model;

import java.util.ArrayList;
import java.util.List;

/**
 * 系统资源  实体类
 * @author weiwei
 */
public class Sysres {

    public static final int state_enable = 1;
    public static final int state_disable = 2;

    private Integer id;
    private Integer parentId;
    private Sysres parent;
    private String name;
    private String path;
    private String method;
    private String no;
    private String icon;
    private String desc;
    private Boolean navnode;
    private Integer state;
    private List<Sysres> children = new ArrayList<>();

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    public Sysres getParent() {
        return parent;
    }

    public void setParent(Sysres parent) {
        this.parent = parent;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public Boolean getNavnode() {
        return navnode;
    }

    public void setNavnode(Boolean navnode) {
        this.navnode = navnode;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public List<Sysres> getChildren() {
        return children;
    }

    public void setChildren(List<Sysres> children) {
        this.children = children;
    }

    public Sysres clone() {
        Sysres clone = new Sysres();
        clone.setId(this.getId());
        clone.setParentId(this.getParentId());
        clone.setName(this.getName());
        clone.setPath(this.getPath());
        clone.setMethod(this.getMethod());
        clone.setNo(this.getNo());
        clone.setIcon(this.getIcon());
        clone.setDesc(this.getDesc());
        clone.setNavnode(this.getNavnode());
        clone.setState(this.getState());
        return clone;
    }

    public Boolean hasNavChild() {
        for (Sysres child : this.children) {
            if (child.getNavnode()) {
                return true;
            }
        }
        return false;
    }
}
